﻿using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;

namespace Sora.Sharding.EntityFramework.Core
{
    public static class Demo1EntityFlag
    {
        public static bool IsInit { get; set; } 
    }


    /// <summary>
    /// 
    /// </summary>
    public class Demo1Entity : CommonEntity<long>, IEntityMutableTable<Demo1Entity, MasterDbContextLocator>
    {

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Value { get; set; }

        public string[] GetTableName(DbContext dbContext, Type dbContextLocator)
        {
            if (Demo1EntityFlag.IsInit)
            {
                return new string[] { "Demo1Entity_2022100416" };
            }
            Demo1EntityFlag.IsInit = true;
            return new string[] { "Demo1Entity" };
        }
    }
}